﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using SoucreGame.GLO;


namespace SoucreGame.GUI
{
    class guiWelcome
    {
         // màn hình vào game
        Texture2D guiWelCome;  // hinh anh lam nen


        Dictionary<string, Rectangle> dsToaDoGiaoDien;
        ContentManager content;
        GameTime gameTime;
        SpriteBatch spriteBatch;

        public guiWelcome(ContentManager _content, GameTime _gameTime, SpriteBatch _spritBatch)
        {
            content = _content;
            gameTime = _gameTime;
            spriteBatch = _spritBatch;

            if (content != null)
            {
                guiWelCome = content.Load<Texture2D>("GUII\\guiWelcome");

                dsToaDoGiaoDien = content.Load<Dictionary<string, Rectangle>>("GUII\\guiViTri");
            }
        }

        public void Update(GameTime gameTime)
        {
            CGlobalvariable.trangthaitruoc = CGlobalvariable.trangthaihientai;
            CGlobalvariable.trangthaihientai = Mouse.GetState();
            if (CGlobalvariable.trangthaihientai.LeftButton == ButtonState.Pressed && CGlobalvariable.trangthaitruoc.LeftButton == ButtonState.Released)
            {
                if (dsToaDoGiaoDien["guiWelcome"].Contains(new Point(CGlobalvariable.trangthaihientai.X, CGlobalvariable.trangthaihientai.Y)))
                {
                    CGlobalvariable.Chuyengiaodien = true;
                    CGlobalvariable.Giaodiendangchon = GUIEnum.guiLevel;
                }
            }
        }

        public void Draw(GameTime gameTime)
        {
            this.spriteBatch.Draw(guiWelCome, Vector2.Zero, Color.White);
        }
    }
}
